<template>
  <wl-list class="wl-content-container" :listData="myState" @pageChange="pageChange" @sizeChange="sizeChange">
    <wl-query slot="query" @showAdv="showAdv"  @doQuery="doQuery">
      <template slot="main">
          <el-form :model="mainData" class="form-query"  label-width="80px" >
            <wl-form-item :importance="false" label="账号" prop="account_name"   :itemData="mainData">
                <wl-arr-select reqUrl="/account/list.do" :isMore="false" slot="input" slot-scope="col" type="account_name"  :rawData="col.columnData"></wl-arr-select>
            </wl-form-item>
            <wl-form-item :importance="false" label="所属部门" prop="dept_name"   :itemData="mainData">
                <wl-arr-select reqUrl="/dept/list.do" :isMore="false" slot="input" slot-scope="col" type="dept_name"  :rawData="col.columnData"></wl-arr-select>
            </wl-form-item>
              <wl-form-item :importance="false" label="网站名称" prop="web_name"   :itemData="mainData">
                <wl-arr-select reqUrl="/website/manage/admin/list.do"  :isMore="false" slot="input" slot-scope="col" type="web_name"  :rawData="col.columnData"></wl-arr-select>
            </wl-form-item>
          </el-form>
      </template>
      <template slot="adv">
          <el-form :model="advData"  class="form-query"  label-width="80px" >
            <wl-form-item :importance="false" label="日期" prop="date" :itemData="advData">
                <el-date-picker
                  v-model="advData.date"
                  slot="input" slot-scope="col"
                  :unlink-panels="true"
                  value-format ="yyyy-MM-dd HH:mm:ss"
                  :default-time="['00:00:00', '23:59:59']"
                  type="daterange"
                  range-separator="至"
                  start-placeholder="开始日期"
                  end-placeholder="结束日期">
                </el-date-picker>
            </wl-form-item>
          </el-form>
      </template>
    </wl-query>
    <wl-container slot="operator" align="right">
      <wl-tip-button icon="pop_dc" btnType="" setW="135" :isNormal="true" tipsDisabled @click="doDownLoad" label="导出当前记录"></wl-tip-button>
    </wl-container>
    <el-table class="log-table" slot="table" :row-class-name="rowClassName" :data="myState.data_list" style="width: 100%" border stripe @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="40"></el-table-column>
      <el-table-column type="expand">
       <template slot-scope="props">
        <el-form label-position="left" inline class="demo-table-expand">
          <el-form-item label="登录网址">
            <span>{{ props.row.website.url }}</span>
          </el-form-item>
          <el-form-item label="账号">
            <span>{{ props.row.account.name }}</span>
          </el-form-item>
          <el-form-item label="所属部门">
            <span>{{ setName(props.row.depts) }}</span>
          </el-form-item>
          <el-form-item label="登录时间">
            <span>{{ setDate(props.row.login_date) }}</span>
          </el-form-item>
          <el-form-item label="登录IP">
            <span>{{ props.row.ip }}</span>
          </el-form-item>
          <el-form-item label="网站名称">
            <span>{{ props.row.website.name}}</span>
          </el-form-item>
        </el-form>
      </template>
      </el-table-column>
      <el-table-column prop="account.name" label="账号"></el-table-column>
      <el-table-column prop="name" label="所属部门">
        <template slot-scope="scope">
         <wl-column field="name" :rawData="scope.row.depts"></wl-column>
        </template>
      </el-table-column>
          <el-table-column prop="login_date" label="登录时间">
              <template slot-scope="scope">
                  <wl-column type="date" field="login_date" :rawData="scope.row"></wl-column>
              </template>
          </el-table-column>
          <el-table-column prop="ip" label="登录IP"></el-table-column>
      <el-table-column prop="website.url" label="登录网址"></el-table-column>
    </el-table>
  </wl-list>
</template>
<script lang="ts" src="./log.ts"></script>
